Empty Object

Modified on 2012/01/20 20:08 by John — Categorized as: Jetfire Language

Empty Object

An empty object is a 'read only' object that is automatically created by Jetfire as required on a per workflow class basis. It is a major component of Jetfire's Void Safety mechanisms.

Assigning Empty

Workflows are automatically assigned to the empty object. For example
MyClass myObject; // is really MyClass myObject = MyClass.Empty();

Testing for Empty

Empty object can be tested using the follow contructs:
if (myObject == MyClass.Empty()) ...
or
if (isEmpty(myObject))...
Note: The method 'isEmpty' will also return true if the parameter is null.

Modifying an Empty Object

A 'Empty' object is a 'read only' object and can not be modified currently in Jetfire code. It can be modified by editing the XML representation of the empty object found in the Server Nexus persistent storage mechanism.

Creating a Custom Empty Object (V1.3.5)

A custom empty object can be created in a class by inserting a empty creation method called 'CreateEmpty()'. If this method is found the parser will execute this method a the end of parsing/code creation process, assigning the return value to the empty object for the class.

Rules for 'CreateEmtpy' method (enforced by parser).
@"namespace Test
{
public workflow Color
{
string c;
public string Value
{
get{return c;}
}
// constructor
public Color(string c)
{
this.c = c;
}
// Executes after the static constructor executes.
// The method 'CreateEmpty()' is called automatically at
// the end of parse/compilation process.
public static Color CreateEmpty()
{
// make the empty color 'no color'
Color color = new Color(""no color"");
return color;
}
}
}



See Also